package ${ConfigPackage};

import com.myapp.data.config.ann.DataDefine;
import com.myapp.data.config.build.interfaces.IInitBean;
import com.myapp.data.define.BaseBean;

/**
 * 文件名：${Name?cap_first}Bean.java
 * <p>
 * 功能：${FileName} -> ${Name}Bean
 * <p>
 * 版本：1.0.0
 * <p>
 * 作者：Builderd by AppTools
 * <p>
 */
@DataDefine(configFileName = "config/${FileName}", idColunm = "${IdColunm}", name = "${Name}", sheetFileName = "${SheetName}")
public class ${Name?cap_first}Bean extends BaseBean implements IInitBean {
	
<#if FieldBeans?size!=0>
	<#list FieldBeans as field>
	//${field.znName}
	<#if field.fieldType == "int">
	private ${field.fieldType} ${field.enName} = 0;
	</#if>
	<#if field.fieldType == "long">
	private ${field.fieldType} ${field.enName} = 0;
	</#if>
	<#if field.fieldType == "String">
	private ${field.fieldType} ${field.enName} = null;
	</#if>
	<#if field.fieldType == "boolean">
	private ${field.fieldType} ${field.enName} = false;
	</#if>
	<#if field.fieldType == "byte">
	private ${field.fieldType} ${field.enName} = 0;
	</#if>
	<#if field.fieldType == "short">
	private ${field.fieldType} ${field.enName} = 0;
	</#if>
	
	</#list>
</#if>
<#if FieldBeans?size!=0>
	<#list FieldBeans as field>
	//${field.znName}的get方法
	public ${field.fieldType} get${field.enName?cap_first}() {
		return ${field.enName};
	}

	//${field.znName}的set方法
	public void set${field.enName?cap_first}(${field.fieldType} ${field.enName}) {
		this.${field.enName} = ${field.enName};
	}
	
	</#list>
</#if>
	@Override
	public void initBean(String[] data) {
	<#if FieldBeans?size!=0>
		<#list FieldBeans as field>
		//${field.znName}
		<#if field.fieldType == "int">
		if(data[${field_index}] == null || data[${field_index}] == ""){
			this.${field.enName} = 0 ;
		}else{		
			this.${field.enName} = Integer.parseInt(data[${field_index}]);
		}
		</#if>
		<#if field.fieldType == "long">
		if(data[${field_index}] == null || data[${field_index}] == ""){
			this.${field.enName} = 0 ;
		}else{	
			this.${field.enName} = Long.parseLong(data[${field_index}]);
		}
		</#if>
		<#if field.fieldType == "String">
		this.${field.enName} = data[${field_index}];
		</#if>
		<#if field.fieldType == "boolean">
		if(data[${field_index}] == null || data[${field_index}] == ""){
			this.${field.enName} = 0 ;
		}else{
			this.${field.enName} = Boolean.parseBoolean(data[${field_index}]);
		}
		</#if>
		<#if field.fieldType == "byte">
		if(data[${field_index}] == null || data[${field_index}] == ""){
			this.${field.enName} = 0 ;
		}else{
			this.${field.enName} = Byte.parseByte(data[${field_index}]);
		}
		</#if>
		<#if field.fieldType == "short">
		if(data[${field_index}] == null || data[${field_index}] == ""){
			this.${field.enName} = 0 ;
		}else{
			this.${field.enName} = Short.parseShort(data[${field_index}]);
		}
		</#if>
	
		</#list>
	</#if>
	}
}